package com.j2ee.student.controller;

import com.j2ee.student.util.JWTUtil;
import org.apache.shiro.SecurityUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: TODO
 * @author: 高思源
 * @date: 2022年05月28日 19:08
 */

@RestController
@RequestMapping("self")
public class SelfController {

    @GetMapping
    public void getCurrentUser(){
        String token = (String)SecurityUtils.getSubject().getPrincipal();
        String username = JWTUtil.getUsername(token);
        System.out.println(username);
    }
}
